@extends('layouts.app')
@section('description',$topic->excerpt)
@section('content')


<div class="container">
    <div class="col-md-10 col-md-offset-1">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h1 align="center"> {{ $topic->title }}</h1>
            </div>

            <div class="panel-body">
                <div class="well well-sm">
                    <div class="row">
                        <div class="col-md-6">
                            <a class="btn btn-link" href="{{ route('topics.index') }}"><i class="glyphicon glyphicon-backward"></i> Back</a>

                        </div>
                        <div class="col-md-6">
                             <a class="btn btn-sm btn-warning pull-right" href="{{ route('topics.edit', $topic->id) }}">
                                <i class="glyphicon glyphicon-edit"></i> Edit
                            </a>
                            <form action="{{ route('topics.destroy', $topic->id) }}" method="post">
                                {{ csrf_field() }}
                                {{ method_field('DELETE') }}
                                <button type="submit" class="btn btn-default btn-xs pull-left">
                                    <i class="glyphicon glyphicon-trash"></i>
                                    删除
                                </button>
                            </form>

                        </div>
                    </div>
                </div>


                <div class="topic-body">
                    {!! $topic->body !!}
                </div>
                <div class="article-meta text-center">
                    {{ $topic->created_at->diffForHumans() }}
                    <span class="glyphicon glyphicon-comment" aria-hidden="true"></span>
                    {{ $topic->reply_count }}
                </div>
                <div class="panel panel-default topic-reply">
                    <div class="panel-body">
                        @includeWhen(Auth::check(),'topics._reply_box', ['topic' => $topic])
                        @include('topics._reply_list')
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection
